import React, { Component } from 'react';
import { connect } from 'react-redux'
import {addGun, removeGun, addGunAsync} from './index.redux'


@connect(state => ({num:state.counter}),{addGun, removeGun, addGunAsync})
class App extends Component {
  render(){
    const addGun = this.props.addGun
    const removeGun = this.props.removeGun
    const addGunAsync = this.props.addGunAsync
    const num = this.props.num
    
    return (
    <div>
      <h1>现在有机枪{num}把</h1>
      <button onClick = { addGun}>申请武器</button>
      <button onClick = {removeGun}>减少武器</button>
      <button onClick = {addGunAsync}>过两天武器</button>
    </div>
    )
  }
}
export default App;
